home *** CD-ROM | disk | FTP | other *** search
/ 10,000 Great Games / 10,000 Great Games.iso / Product / 66 / data1.cab / Source_Files / Src / Crate.cpp < prev    next >
C/C++ Source or Header  |  2000-01-16  |  655b  |  38 lines

  1. #include "stdafx.h"
  2.  
  3. cCrate::cCrate(int _x, int _y, cProperties *_orig)
  4.         : cWeapon(_x, _y, _orig, "MOVING")
  5.     move_object_after_hit = FALSE;
  6.  
  7.     ASSERT(!crate_contents_list.is_empty());
  8. }
  9.  
  10. cCrate::~cCrate()
  11. {
  12. }
  13.  
  14. int cCrate::control()
  15.     cWeapon::control();
  16.     
  17.     bounce_on_boundaries();
  18.     
  19.     // If hit drop stuff down
  20.     
  21.     if (explode)
  22.     {
  23.         int n = orig->params->get_int("*OBJECTS_INSIDE", 5);
  24.             
  25.         for (int i = 0; i < n; i++)
  26.         {
  27.             cFalling *f = new cFalling (x, y, crate_contents_list.get_random());
  28.             f->add_angular_speed(150, (96 + i * 192 / (n - 1)) & 255);
  29.         }
  30.         
  31.         return FALSE;
  32.     }
  33.     
  34.     return !in_water();
  35. }
  36.